#ifndef PLOTDIALOG_H
#define PLOTDIALOG_H

#include <QDialog>
#include "mainwindow.h"
#include "qcustomplot.h"

#define BUF_MAX_LEN 10000

namespace Ui {
class PlotDialog;
}

class MainWindow;

class PlotDialog : public QDialog
{
    Q_OBJECT

public:
    explicit PlotDialog(QWidget *parent = 0);
    ~PlotDialog();

    void Copy2Buffer(const QByteArray &data);

    void Replot(QCustomPlot *customPlot, const QByteArray &data);

public slots:
    void getData(const QByteArray &data);
    void ClearData();

private slots:
    void on_lineEdit_BufferLen_editingFinished();

private:
    Ui::PlotDialog *ui;
    double data_x[BUF_MAX_LEN];
    qint32 point_cnt;
    qint32 buffer_length;
};

#endif // PLOTDIALOG_H
